import $ from 'jquery'
import querystring from 'querystring'
import url from 'url'

const  to_url = function (urlstr, query={}) {

  var result = url.parse(urlstr);
  result.query = $.extend(querystring.parse(result.query), query)

  return url.format(result)

};
class storage{
  static set(key,data){
    data = JSON.stringify(data);
    localStorage.setItem(key,data);
  }
  static del(key) {

  }
  static get(key){
    let data = localStorage.getItem(key);
    return JSON.parse(data);
  }
}

export   {to_url,storage};
